package com.designpattern.softwaredesignpatternstudy.pattern.proxy;

/**
 * @Author: Jiangxx
 * @Date: 2022/03/11
 * @Description:
 */
public class Proxy implements Subject{

    private RealSubject realSubject;

    public void preRequest() {
        if (realSubject == null) {
            realSubject = new RealSubject();
        }
        System.out.println("处理之前");
    }
    @Override
    public void request() {
        preRequest();
        realSubject.request();
        postRequest();
    }

    public void postRequest() {
        System.out.println("处理之后");
    }
}
